package com.qiezi.common.response;

import com.qiezi.common.enumerate.ResponseCodeEnum;
import com.qiezi.common.exception.MessageException;
import lombok.Data;

import java.util.List;

@Data
public class CommonResponse {
    private ResponseCodeEnum responseCode;
    private Object result;
    private List<String> messageList;

    public CommonResponse() {
        responseCode = ResponseCodeEnum.SUCCESS;
    }

    public CommonResponse(MessageException exception) {
        responseCode = ResponseCodeEnum.FAIL;
        messageList = exception.getMessageList();
    }

    public CommonResponse(Object result) {
        responseCode = ResponseCodeEnum.SUCCESS;
        this.result = result;
    }

    public CommonResponse(List<String> messageList) {
        responseCode = ResponseCodeEnum.FAIL;
        this.messageList = messageList;
    }
}
